package ups.MapParse;
import java.util.Comparator;

public class PositionedLetterComparator implements Comparator<PositionedLetter>{
	public int compare( PositionedLetter o1, PositionedLetter o2 ) {
		Point p1  = o1.getLocation();
		Point p2  = o2.getLocation();
		
		if( p1.y > p2.y ) {
			return 1;
		} else if ( p1.y < p2.y ) {
			return -1;
		} else if( p1.y == p2.y ) {
			if( p1.x > p2.x ) {
				return 1;
			}
			if( p1.x < p2.x ) {
				return -1;
			}
			
			if( p1.x == p2.x ) {
				return 0;
			}
		}
		
		return 0;
	}
}
